package com.rraj.common.mq.mqenum;

/**
 * Created by WangSheng on 2017/6/19.
 *
 * @author WangSheng
 * @date 2017/06/19
 */
public enum MQTagEnum {
    TAG_TEST_SYNC(1, "TAG_TEST_SYNC", "TOPIC_TEST_TOPIC1", "TOPIC_TEST_TOPIC1","测试tag，演示demo");
    /**
     * 唯一标识
     */
    private int id;
    /**
     * TAG的code
     * 命名格式：TAG_TAG名称
     */
    private String code;
    /**
     * 所属的topic
     */
    private String topic;
    /**
     * 所属的tag的值
     */
    private String value;
    /**
     * 描述
     */
    private String desc;

    MQTagEnum(int id, String code, String topic, String value, String desc) {
        this.id = id;
        this.code = code;
        this.topic = topic;
        this.value = value;
        this.desc = desc;
    }

    public static MQTagEnum getEnumById(int id) {
        for (MQTagEnum c : MQTagEnum.values()) {
            if (c.getId() == id) {
                return c;
            }
        }
        return null;
    }
    public static MQTagEnum getEnumByCode(String code) {
        for (MQTagEnum c : MQTagEnum.values()) {
            if (c.getCode().equals(code)) {
                return c;
            }
        }
        return null;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getTopic() {
        return topic;
    }

    public void setTopic(String topic) {
        this.topic = topic;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
